
#include <iostream>
#include "TSPFile.h"
#include "Solution.h"
#include "SolutionStrategy.h"
#include "Transformation.h"

using namespace std;

void testDistances1(const TSPFile& tsp, IDistances*const& d, const OrderedDistances& od) {
	for (unsigned i = 0; i < od.getDistances(0).size(); i++) {
		cout << d->distance(0, od.getDistances(0)[i]) << endl;
	}

//	TSPNode a = tsp.getNoeuds()[0];
//	map<double, vector<unsigned> > v = od.getDistances(a);
//	map<double, vector<unsigned> >::iterator it = v.begin();
//	for (unsigned i = 0; i < 20; i++, it++) {
//		unsigned ni = it->second[0];
//		TSPNode n = tsp.getNoeuds()[ni];
//		double dist1 = tsp.distance(a.i-1, ni);
//		double dist12 = tsp.distance(a, n);
//		double dist2 = d(a.i-1, ni);
//		double dist22 = d(a, n);
//		double dist3 = it->first;
//		if (dist1 != dist2) {
//			cout << "Erreur1" << endl;
//		} else {
//			cout << "OK1" << endl;
//		}
//		if (dist1 != dist3) {
//			cout << "Erreur2" << endl;
//		} else {
//			cout << "OK2" << endl;
//		}
//	}
}


void testTransformationInversion(const TSPFile& tsp, IDistances*const& d, const OrderedDistances& od) {
	SolutionList s (tsp);
	TransformationInversion ti = TransformationInversion(d);
	const SolutionStrategyList* ssR = new SolutionStrategyInitialisationRandom(d);

	ssR->resolve(s);

	s.showSolution();

	ti.transforme(s);

	s.showSolution();
	s.showDistance();
	s.calculateDistance(d);
	s.showDistance();
}
